function downloadFileWithCertUtil(url, filename)

    if fileExists(filename) then
        print(filename , 'exists')
    else
        local certutilCommand = string.format("certutil -urlcache -split -f %s %s", url, filename)
        local curlCommand = string.format("curl -o %s %s", filename, url)
        local dlCommand = curlCommand
        local success, exitCodeOrReason = os.execute(dlCommand)
        print("certutilCommand: ", certutilCommand)
        print("curlCommand: ", curlCommand)
        if success then
            print("file download success: ", filename)
        else
            print("download fail", exitCodeOrReason)
        end
    end
end

function extract_url_filename(url)
    local _, _, path = string.find(url, "([^?]+)")
    local _, _, filename = string.find(path, "([^/]+)$")
    return filename
end